package ${location}.common;

import java.io.Serializable;

/**
 * 常用状态响应码
 *
 * @author ecelin
 */
public enum HttpCode implements Serializable {

	/**
	 * Continue
	 */
	_100_CONTINUE(100, "目前为止一切正常, 客户端应该继续请求"),

	/**
	 * Switching Protocols
	 */
	_101_SWITCHING_PROTOCOLS(101, "切换协议"),

	/**
	 * Processing
	 */
	_102_PROCESSING(102, "服务器已收到并正在处理该请求，但没有响应可用"),

	/**
	 * Checkpoint
	 */
	_103_CHECKPOINT(103, "检查点"),

	/**
	 * OK
	 */
	_200_OK(200, "成功"),

	/**
	 * Created
	 */
	_201_CREATED(201, "请求已经被成功处理，并且创建了新的资源"),

	/**
	 * Accepted
	 */
	_202_ACCEPTED(202, "收到请求消但是尚未处理"),

	/**
	 * Non-Authoritative Information
	 */
	_203_NON_AUTHORITATIVE_INFORMATION(203, "非授权信息"),

	/**
	 * No Content
	 */
	_204_NO_CONTENT(204, "无内容"),

	/**
	 * Reset Content
	 */
	_205_RESET_CONTENT(205, "重置内容"),

	/**
	 * Partial Content
	 */
	_206_PARTIAL_CONTENT(206, "部分内容"),

	/**
	 * Multi-Status
	 */
	_207_MULTI_STATUS(207, "多重状态"),

	/**
	 * Already Reported
	 */
	_208_ALREADY_REPORTED(208, "已报告"),

	/**
	 * IM Used
	 */
	_226_IM_USED(226, "服务器已经完成了对资源的请求"),

	/**
	 * Multiple Choices
	 */
	_300_MULTIPLE_CHOICES(300, "多重选择"),

	/**
	 * Moved Permanently
	 */
	_301_MOVED_PERMANENTLY(301, "永久移除"),

	/**
	 * Moved Temporarily
	 */
	_302_MOVED_TEMPORARILY(302, "临时移动"),

	/**
	 * See Other
	 */
	_303_SEE_OTHER(303, "参见其他"),

	/**
	 * Not Modified
	 */
	_304_NOT_MODIFIED(304, "未修改"),

	/**
	 * Use Proxy
	 */
	_305_USE_PROXY(305, "使用代理"),

	/**
	 * Temporary Redirect
	 */
	_307_TEMPORARY_REDIRECT(307, "临时重定向"),

	/**
	 * Permanent Redirect
	 */
	_308_PERMANENT_REDIRECT(308, "永久重定向"),

	/**
	 * Bad Request
	 */
	_400_BAD_REQUEST(400, "错误的请求"),

	/**
	 * Unauthorized
	 */
	_401_UNAUTHORIZED(401, "未授权"),

	/**
	 * Payment Required
	 */
	_402_PAYMENT_REQUIRED(402, "需要付费"),

	/**
	 * Forbidden
	 */
	_403_FORBIDDEN(403, "禁止访问"),

	/**
	 * Not Found
	 */
	_404_NOT_FOUND(404, "服务器端无法找到所请求的资源"),

	/**
	 * Method Not Allowed
	 */
	_405_METHOD_NOT_ALLOWED(405, "不支持当前请求方法"),

	/**
	 * Not Acceptable
	 */
	_406_NOT_ACCEPTABLE(406, "请求资源不可访问"),

	/**
	 * Proxy Authentication Required
	 */
	_407_PROXY_AUTHENTICATION_REQUIRED(407, "需要代理身份验证"),

	/**
	 * Request Timeout
	 */
	_408_REQUEST_TIMEOUT(408, "请求超时"),

	/**
	 * Conflict
	 */
	_409_CONFLICT(409, "服务器在完成请求时发生冲突"),

	/**
	 * Gone
	 */
	_410_GONE(410, "资源已永久删除"),

	/**
	 * Length Required
	 */
	_411_LENGTH_REQUIRED(411, "需要有效长度"),

	/**
	 * Precondition Failed
	 */
	_412_PRECONDITION_FAILED(412, "未满足前提条件"),

	/**
	 * Request Entity Too Large
	 */
	_413_PAYLOAD_TOO_LARGE(413, "请求实体过大"),

	/**
	 * URI Too Long
	 */
	_414_URI_TOO_LONG(414, "请求的 URI 过长"),

	/**
	 * Unsupported Media Type
	 */
	_415_UNSUPPORTED_MEDIA_TYPE(415, "不支持的媒体类型"),

	/**
	 * Requested range not satisfiable
	 */
	_416_REQUESTED_RANGE_NOT_SATISFIABLE(416, "请求范围不符合要求"),

	/**
	 * Expectation Failed
	 */
	_417_EXPECTATION_FAILED(417, "未满足期望值"),

	/**
	 * Insufficient Space On Resource
	 */
	_419_INSUFFICIENT_SPACE_ON_RESOURCE(419, "资源空间不足"),

	/**
	 * Method Failure
	 */
	_420_METHOD_FAILURE(420, "方法失败"),

	/**
	 * Destination Locked
	 */
	_421_DESTINATION_LOCKED(421, "目标已锁定"),

	/**
	 * Unprocessable Entity
	 */
	_422_UNPROCESSABLE_ENTITY(422, "无法处理的实体"),

	/**
	 * Locked
	 */
	_423_LOCKED(423, "已锁定"),

	/**
	 * Failed Dependency
	 */
	_424_FAILED_DEPENDENCY(424, "失败的依赖项"),

	/**
	 * Too Early
	 */
	_425_TOO_EARLY(425, "太早了"),

	/**
	 * Upgrade Required
	 */
	_426_UPGRADE_REQUIRED(426, "需要升级"),

	/**
	 * Precondition Required
	 */
	_428_PRECONDITION_REQUIRED(428, "要求先决条件"),

	/**
	 * Request Header Fields Too Large
	 */
	_429_TOO_MANY_REQUESTS(429, "请求太多"),

	/**
	 * Request Header Fields Too Large
	 */
	_431_REQUEST_HEADER_FIELDS_TOO_LARGE(431, "请求头字段太大"),

	/**
	 * Unavailable For Legal Reasons
	 */
	_451_UNAVAILABLE_FOR_LEGAL_REASONS(451, "因法律原因不可用"),

	/**
	 * Internal Server Error
	 */
	_500_INTERNAL_SERVER_ERROR(500, "内部服务器错误"),

	/**
	 * Not Implemented
	 */
	_501_NOT_IMPLEMENTED(501, "未执行"),

	/**
	 * Bad Gateway
	 */
	_502_BAD_GATEWAY(502, "网关错误"),

	/**
	 * Service Unavailable
	 */
	_503_SERVICE_UNAVAILABLE(503, "服务不可用"),

	/**
	 * Gateway Timeout
	 */
	_504_GATEWAY_TIMEOUT(504, "网关超时"),

	/**
	 * HTTP Version not supported
	 */
	_505_HTTP_VERSION_NOT_SUPPORTED(505, "不支持HTTP版本"),

	/**
	 * Variant Also Negotiate
	 */
	_506_VARIANT_ALSO_NEGOTIATES(506, "对请求的透明内容协商导致循环引用"),

	/**
	 * Insufficient Storage
	 */
	_507_INSUFFICIENT_STORAGE(507, "存储不足"),

	/**
	 * Loop Detected
	 */
	_508_LOOP_DETECTED(508, "检测到无限循环"),

	/**
	 * Bandwidth Limit Exceeded
	 */
	_509_BANDWIDTH_LIMIT_EXCEEDED(509, "超过带宽限制"),

	/**
	 * Not Extended
	 */
	_510_NOT_EXTENDED(510, "未扩展"),

	/**
	 * Network Authentication Required
	 */
	_511_NETWORK_AUTHENTICATION_REQUIRED(511, "需要网络身份验证");


	/**
	 * 响应状态码
	 */
	private int code;

	/**
	 * 提示信息
	 */
	private String msg;

	HttpCode(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public int getCode() {
		return code;
	}


	public String getMsg() {
		return msg;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	@Override
	public String toString() {
		return "ErrorCode{" +
				"code=" + code +
				", msg='" + msg + '\'' +
				'}';
	}

	private static final long serialVersionUID = 1L;
}
